﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.CMS263.PO;
using NHibernate;
namespace Com.CMS263.DAO
{
   public class MyStyleDAO:BaseService
    {
       /// <summary>
       /// 通过编号查找风格
       /// </summary>
       /// <param name="id">编号</param>
       /// <returns></returns>
       public MyStyle GetStyleById(int id)
       {
          return (MyStyle)this.FindModelById("MyStyle", id);
       }


       public MyStyle GetStyleByLevel(int level) 
       {
           IQuery iq = DBHelper.ExecuteHQL("from MyStyle where stylelevel="+level+" ");
           if (iq.List().Count>0)
           {
               return iq.List<MyStyle>().First();
           }
           return null;
       }

       public bool Add(MyStyle style)
       {
          return  base.Add(style);
       }





       public IList<MyStyle> GetAll(string p)
       {
         return  DBHelper.ExecuteHQL(p).List<MyStyle>();
       }
    }
}
